import request from "../utils/request";

export function getHouses() {
    return request.get('/house/list')
}

export function getHouseById(id) {
    return request.get(`/house/${id}`)
}

export function getHousePage(pageNum, pageSize) {
    return request.get(`/house/page?pageSize=${pageSize}&pageNum=${pageNum}`)
}
export function searchByTitle(title) {
    return request.get(`/house/search?title=${title}`)
}


export function getHouseImgById(id) {
    return request.get(`/houseImg/${id}`)
}

export function getHouseByCategoryId(id) {
    return request.get(`/house/cate/${id}`)
}

export function reserveHouse(reserce) {
    return request.post('/reserve', {
        ...reserce
    })
}

export function getreserveByUserId(userId) {
    return request.get(`/reserve/my/${userId}`)
}

// batch
export function deleteReserve(ids) {
    return request.delete('/reserve/batch', {
        data: { ids }
    })
}

export function submitReserve(ids) {
    return request.put('/reserve/batch', {
        ids
    })
}